package br.com.arndroid.coupman.site;

import br.com.arndroid.lib.entity.EntityPOJO;

public class SitePOJO extends EntityPOJO {

	@Override
	public String getName() {
		return name;
	}
	
	public String name;
	
	public String url_uri;
	
	@Override
	public boolean equals(Object obj) {
		if(super.equals(obj)) {
			return true;
		} else if(obj instanceof SitePOJO) {
			SitePOJO temp = (SitePOJO) obj;
			//_id:
			if(this._id != null) {
				if(!this._id.equals(temp._id))
					return false;
			} else {
				if(temp._id != null)
					return false;
			}

			//name:
			if(this.name != null) {
				if(!this.name.equals(temp.name))
					return false;
			} else {
				if(temp.name != null)
					return false;
			}
			
			//url_uri must be considered for equality
			//for tests purposes:
			if(this.url_uri != null) {
				if(!this.url_uri.equals(temp.url_uri))
					return false;
			} else {
				if(temp.url_uri != null)
					return false;
			}			

			return true;

		}
		return false;
	}
	
	@Override
	public int hashCode() {		
		int result;
		result = _id == null? 0 : _id.hashCode();
		result += name == null? 0: name.hashCode();
		result += url_uri == null? 0: url_uri.hashCode();
		return result;
	}
}
